package com.gitee.lht.common.IAssert;

/**
 * 业务断言工具类
 *
 * @author Eric
 * @version 1.0
 * @date 2019-12-13
 */
public class Assert {

    public void nullAssert(Object obj,ErrorInfo info) throws Exception {
        iAssert(new NotNullCondition<Object>(obj),info,AbstractBusinessException.class);
    }

    public <T extends AbstractBusinessException> void iAssert(Condition condition, ErrorInfo info, Class<T> exception) throws Exception {
        if (condition.condition()) {
            throw exception.newInstance();
        }
    }
}
